/**
 * 项目示例-列表表头
 * Date 2023-5-25 09:33:56
 * 可选参数可参考：https://element-plus.org/zh-CN/component/table.html#table-column-属性
 */
import type, {TableColumnCtx} from 'element-plus'

interface ExampleListItem {
    eqptCode: string;
    eqptType: string;
    eqptName: string;
    eqptModel: string;
    useOrgans: string;
    owner: string;
    position: string;
    coordinate: string;
}

export const mapListColumns = [
    {type: 'index', label: '序号', width: 60, align: 'center'},
    {
        prop: 'eqptCode',
        label: '设备编号',
        sortable: true,
        width: 130,
        align: 'center',
        formatter(row: any, column: any, cellValue: any) {
            if (cellValue && cellValue.trim() != '') {
                return cellValue
            } else {
                return "-"
            }
        }
    },
    {prop: 'typeName', label: '设备类型', minWidth: 130, align: 'center'},
    {
        prop: 'eqptName',
        label: '设备名称',
        sortable: true,
        minWidth: 200,
        align: 'center',
        formatter(row: any, column: any, cellValue: any) {
            if (cellValue && cellValue.trim() != '') {
                return cellValue
            } else {
                return "-"
            }
        }
    },
    {
        prop: 'eqptModel',
        label: '设备型号',
        minWidth: 120,
        align: 'center',
        formatter(row: any, column: any, cellValue: any) {
            if (cellValue && cellValue.trim() != '') {
                return cellValue
            } else {
                return "-"
            }
        }
    },
    {
        prop: 'combinedOrganNames',
        label: '使用部门',
        minWidth: 120,
        align: 'center',
        formatter(row: any, column: any, cellValue: any) {
            if (cellValue && cellValue.trim() != '') {
                return cellValue
            } else {
                return "-"
            }
        }
    },
    {
        prop: 'ownerName',
        label: '归属单位',
        minWidth: 120,
        align: 'center',
        formatter(row: any, column: any, cellValue: any) {
            if (cellValue && cellValue.trim() != '') {
                return cellValue
            } else {
                return "-"
            }
        }
    },
    {
        prop: 'position',
        label: '位置', width: 210,
        align: 'center',
        formatter(row: any, column: any, cellValue: any) {
            if (cellValue && cellValue.trim() != '') {
                return cellValue
            } else {
                return "-"
            }
        }
    },
    {
        prop: 'coordinate',
        label: '地图坐标',
        width: 215,
        align: 'center',
        formatter(row: any, column: any, cellValue: string) {
            // @ts-ignore
            if (cellValue?.latitude && cellValue?.longitude) {
                // @ts-ignore
                return "(" + cellValue.latitude + "," + "  " + cellValue?.longitude + ")"
            } else {
                return '-';
            }
        }
    },
    {prop: 'action', label: '操作', fixed: 'right', width: 210, align: 'center'}
]
export const thresholdListColumns = [
    {prop: 'area', label: '区域', width: 80, align: 'center'},
    {prop: 'historicalAverage', label: '历史平均值', minWidth: 100, align: 'center'},
    {prop: 'isAlarm', label: '是否报警', minWidth: 100, align: 'center'},
    {prop: 'setThreshold', label: '设置阈值', minWidth: 100, align: 'center'}
]
